class JiFenRankView extends BaseView{

    constructor(){
        super();
        this.addEventListener(egret.Event.ADDED_TO_STAGE,this.initView,this);
    }

    private bgMaskShap:egret.Shape;
    private gr_btn:egret.Bitmap;
    private bh_btn:egret.Bitmap;
    private bg_jf:egret.Bitmap;
    private my_rank:egret.DisplayObjectContainer;
    private tableView:TableView.TableView;
    private gr_text:egret.TextField;
    private bh_text:egret.TextField;
    private contentviewbg:egret.Bitmap;
    private now_tab:number = 0;
    private title:egret.TextField;
    private close_btn:egret.Bitmap;
    private gr_Container:egret.DisplayObjectContainer;
    private bh_Container:egret.DisplayObjectContainer;
    private sq_btn:egret.Bitmap;
    private contentview:egret.DisplayObjectContainer;
    private emptyLabel_text:egret.TextField;
    private emptyLabel_img:egret.Bitmap;
    public end_time:number = 0;
    public type:number = 1; //1-本期奖励 2-下期奖励
    //距离结束
    private end_view:egret.DisplayObjectContainer;
    private _bitmapText:egret.BitmapText;
    private award_list_view:egret.DisplayObjectContainer;
    private bgMaskAward:egret.Shape;
    private hasTimerEvent:Boolean = false;
    private countdown:egret.Timer;



    private queryGrRank():void{
        this.now_tab = 1;
        var _that = this;
        var params = {
            'count':50
        }
        CurlUtil.curl(config.api_url + '/bxg/rank/personal/now',params).then(function(data:any){
            if(_that.now_tab == 2){
                return;
            }
            if(data.status == "success"){
               _that.createGrJiFenView(data.data);
            }else{
                // Toast.makeText({ text: '调用接口失败！{code:'+data.code+'}' }).show();
                 _that.showEmpty();
            }
        }).catch(function(){
            // Toast.makeText({ text: '调用接口失败！' }).show();
            _that.showEmpty();
        });
    }

    private queryBhRank():void{
        this.now_tab = 2;
        var _that = this;
        var params = {
            'count':50
        }
        CurlUtil.curl(config.api_url + '/bxg/rank/gang/now',params).then(function(data:any){
            if(_that.now_tab == 1){
                return;
            }
            if(data.status == "success"){
               _that.createBhJiFenView(data.data);
            }else{
                // Toast.makeText({ text: '调用接口失败！{code:'+data.code+'}' }).show();
                 _that.showEmpty();
            }
        }).catch(function(){
            // Toast.makeText({ text: '调用接口失败！' }).show();
            _that.showEmpty();
        });
    }

    private showEmpty():void{
        this.tableView.dataSource = [];
        if(this.contentview.contains(this.my_rank)){
            this.contentview.removeChild(this.my_rank);
        }
        this.emptyLabel_text.visible = true;
        this.emptyLabel_img.visible = true;
    }


    private initView():void{


        //背景
        if(!this.contains(this.bgMaskShap)){
            var bgMaskShap = new egret.Shape();
            bgMaskShap.graphics.beginFill(0x000000, 0.6);
            bgMaskShap.graphics.drawRect(0, 0, this.width, this.height);
            bgMaskShap.graphics.endFill();
            bgMaskShap.touchEnabled = true;
            this.bgMaskShap = bgMaskShap;
            this.addChild(bgMaskShap);
        }

        if(!this.contains(this.contentview)){
            this.contentview = new egret.DisplayObjectContainer;
            this.addChild(this.contentview);
            this.contentview.width = this.width;
            this.contentview.height = this.height;
            this.contentview.x = (this.contentview.width)/2;
            this.contentview.y = (this.contentview.height)/2;
            this.contentview.anchorOffsetX = this.contentview.width/2;
            this.contentview.anchorOffsetY = this.contentview.height/2;
        }
        

        //背景图
        if(!this.contentview.contains(this.contentviewbg)){
            var contentviewbg = utils.createBitmapByName('friend');
            contentviewbg.scale9Grid = new egret.Rectangle(250, 160, 100, 50);
            contentviewbg.height = this.height*0.9;
            contentviewbg.width = this.width*0.95;
            contentviewbg.anchorOffsetX = contentviewbg.width/2;
            contentviewbg.anchorOffsetY = contentviewbg.height/2;
            contentviewbg.x = (this.width )/2;
            contentviewbg.y = (this.height )/2;
            this.contentviewbg = contentviewbg;
            this.contentview.addChild(contentviewbg);
        }

        //tabbar背景
        if(!this.contentview.contains(this.bg_jf)){
            var bg_jf = utils.createBitmapByName("bg_jf");
            bg_jf.width = contentviewbg.width*0.85;
            bg_jf.height = contentviewbg.height*0.65;
            bg_jf.y = 300;
            bg_jf.x = (this.width - bg_jf.width)/2;
            this.contentview.addChild(bg_jf);
            this.bg_jf = bg_jf;
        }

        //积分榜
        if(!this.contentview.contains(this.title)){
            var title = utils.createTextField();
            title.text = "积分榜";
            title.size = 60;
            title.textColor = 0xFFEA70;
            title.stroke = 5;
            title.bold = true;
            title.strokeColor = 0x6A410D;
            title.x = (this.width -title.width)/2;
            title.y = 100;
            this.title = title;
            this.contentview.addChild(title);
        }

        //关闭按钮
        if(!this.contentview.contains(this.close_btn)){
            var close_btn = utils.createBitmapByName("x",{offsetX:0.5, offsetY:0.5});
            close_btn.x = 682;
            close_btn.y = 136;
            close_btn.touchEnabled = true;
            close_btn.touchAnimation = true;
            this.close_btn = close_btn;
            this.contentview.addChild(close_btn);
            close_btn.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
                Main.removeJFView();
            },this);
        }


        //个人排行榜
        if(!this.contentview.contains(this.gr_Container)){
            var gr_Container = new egret.DisplayObjectContainer;
            this.contentview.addChild(gr_Container);
            this.gr_Container = gr_Container;

            var gr_btn = utils.createBitmapByName("tab1");
            gr_btn.x = 70;
            gr_btn.y = 210;
            gr_btn.touchEnabled = true;
            gr_Container.addChild(gr_btn);
            this.gr_btn = gr_btn;

            var gr_text = utils.createTextField();
            gr_text.x = gr_btn.x;
            gr_text.y = 210;
            gr_text.width = gr_btn.width;
            gr_text.height = (gr_btn.width*66)/190;
            gr_text.textAlign = "center";
            gr_text.verticalAlign = egret.VerticalAlign.MIDDLE;
            gr_text.text = "个人积分榜";
            gr_text.size = 30;
            gr_text.textColor = 0xFFEA70;
            gr_text.stroke = 2;
            gr_text.bold = true;
            gr_text.strokeColor = 0x6A410D;
            this.gr_text = gr_text;
            gr_Container.addChild(gr_text);
            gr_Container.touchEnabled = true;
            gr_Container.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
                this.gr_btn.texture = RES.getRes("tab1");
                this.bh_btn.texture = RES.getRes("tab2");
                this.gr_text.textColor = 0xFFEA70;
                this.bh_text.textColor = 0xEBC275;
                if(this.now_tab == 1){
                    return;
                }
                this.queryGrRank();
            },this);
        }

        //帮会排行榜
        if(!this.contentview.contains(this.bh_Container)){
            var bh_Container = new egret.DisplayObjectContainer;
            this.contentview.addChild(bh_Container);
            this.bh_Container = bh_Container;

            var bh_btn = utils.createBitmapByName("tab2");
            bh_btn.x = gr_btn.x + gr_btn.width + 30;
            bh_btn.y = 210;
            bh_btn.touchEnabled = true;
            bh_Container.addChild(bh_btn);
            this.bh_btn = bh_btn;

            var bh_text = utils.createTextField();
            bh_text.x = bh_btn.x;
            bh_text.width = bh_btn.width;
            bh_text.y = 210;
            bh_text.height = (bh_btn.width*66)/190;
            bh_text.textAlign = "center";
            bh_text.verticalAlign = egret.VerticalAlign.MIDDLE;
            bh_text.text = "帮会积分榜";
            bh_text.size = 30;
            bh_text.textColor = 0xEBC275;
            bh_text.stroke = 2;
            bh_text.bold = true;
            bh_text.strokeColor = 0x6A410D;
            bh_Container.addChild(bh_text);
            this.bh_text = bh_text;
            bh_Container.touchEnabled = true;
            bh_Container.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
                this.bh_btn.texture = RES.getRes("tab1");
                this.gr_btn.texture = RES.getRes("tab2");
                this.bh_text.textColor = 0xFFEA70;
                this.gr_text.textColor = 0xEBC275;
                if(this.now_tab == 2){
                    return;
                }
                this.queryBhRank();
            },this);
        }

        //上期奖励分配按钮
        if(!this.contentview.contains(this.sq_btn)){
            var sq_btn = utils.createBitmapByName("sqfp");
            sq_btn.x = bh_btn.x + bh_btn.width + 30;
            sq_btn.y = 225;
            sq_btn.touchEnabled = true;
            this.sq_btn = sq_btn;
            this.contentview.addChild(sq_btn);
            sq_btn.touchEnabled = true;
            sq_btn.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
                Main.removeJFView();
                Main.showLastJFView();
            },this);
        }

        //列表
        if(!this.contentview.contains(this.tableView)){
            var tableView = new TableView.TableView();
            tableView.height = this.bg_jf.height - 100;
            tableView.scrollPolicyH = "false";   
            // tableView.scrollPolicyV = "false";  
            tableView.width = this.bg_jf.width;
            tableView.anchorOffsetX=tableView.width/2;
            tableView.x = (this.width )/2;
            tableView.y = this.bg_jf.y + 6;
            this.tableView = tableView;
            this.contentview.addChild(this.tableView);
        }


        if(!this.contentview.contains(this.emptyLabel_img)){

            this.emptyLabel_img = utils.createBitmapByName("dj_icon");
            this.emptyLabel_img.x = (this.width - this.emptyLabel_img.width)/2;
            this.emptyLabel_img.y = (this.height - this.emptyLabel_img.height)/2;
            this.contentview.addChild(this.emptyLabel_img);

            this.emptyLabel_img.visible = false;

        }

        if(!this.contentview.contains(this.emptyLabel_text)){
            this.emptyLabel_text = new BaseTextField();
            this.emptyLabel_text.text = "暂无数据!";
            this.emptyLabel_text.width = this.width;
            this.emptyLabel_text.y = this.contentview.y + this.emptyLabel_img.height/2 + 10;
            this.emptyLabel_text.textColor = 0xc19b61;
            this.emptyLabel_text.visible = false;
            this.emptyLabel_text.textAlign = "center";
            this.contentview.addChild(this.emptyLabel_text);

        }
        
        if(this.now_tab == 2){
            this.queryBhRank();
        }else{
            this.queryGrRank();
        }

        this.addAnimation();

        if(this.type == 1 && this.end_time > 0){
            //显示倒计时
            this.createEndView();

        }
    }

    // private getFnt(){
    //     RES.getResByUrl( "resource/assets/sz.fnt", this.createEndView, this,
    //         RES.ResourceItem.TYPE_FONT );
    // }

    //显示倒计时
    private createEndView(){
        this.end_view = new egret.DisplayObjectContainer;
        this._bitmapText = new egret.BitmapText();
        this._bitmapText.font = RES.getRes("sz_fnt");
        this._bitmapText.text = utils.timerSecondFormat(this.end_time);
        this._bitmapText.letterSpacing = 5;
        
        this.contentview.addChild(this.end_view);
       
        var text = utils.createTextField({
            height:this._bitmapText.height
        });
        // text.width = view_1.width;
        // text.height = this._bitmapText.height;
        text.text = "距离结束 ";
        text.size = 27;
        text.textColor = 0x7E3E0F;
        // text.verticalAlign = egret.VerticalAlign.MIDDLE;
        text.textAlign = 'center';
        text.bold = true;

        this.end_view.addChild(text);
        this._bitmapText.x = text.width;
        this.end_view.addChild(this._bitmapText);
        
        this.end_view.x = (this.contentview.width - this.end_view.width)/2;
        this.end_view.y = this.bg_jf.y + this.bg_jf.height+20;


        if(!this.countdown){
            this.countdown = new egret.Timer(1000);
            this.countdown.addEventListener(egret.TimerEvent.TIMER, () => {
                this.end_time--;
                if (this.end_time == 0) {
                    this.countdown.stop();
                    Main.removeJFView();
                }
                this._bitmapText.text = utils.timerSecondFormat(this.end_time);
            }, this);
        } 
        this.countdown.start();
    }

    // 添加动画
    private addAnimation(){
        this.contentview.scaleX = this.contentview.scaleY = 0;
        egret.Tween.removeTweens(this.contentview);
        egret.Tween.get(this.contentview).to({scaleX:1, scaleY:1}, 500, egret.Ease.backOut);
    }

    /**
     * 创建个人排行榜
     */
    public createGrJiFenView(data:any):void{

        this.emptyLabel_text.visible = false;
        this.emptyLabel_img.visible = false;

        var dataSource = data.list;
        this.tableView.dataSource = dataSource;
        this.tableView.itemRenderer = JiFenCell;
        JiFenCell.CELLWIDTH = this.tableView.width;   
        JiFenCell.jfView = this;

        if(dataSource.length <= 0){
            
            this.emptyLabel_text.visible = true;
            this.emptyLabel_img.visible = true;
        }

        if(this.contentview.contains(this.my_rank)){
            this.contentview.removeChild(this.my_rank);
        }

        if(!data.last_add_time){
           this.tableView.height = this.bg_jf.height - 25;
           return;
        }else{
           this.tableView.height = this.bg_jf.height - 100;
        }

        this.my_rank = new egret.DisplayObjectContainer();

        //我的排名
        var bg = utils.createBitmapByName("paiming_mine");
        this.my_rank.width = this.bg_jf.width + 10;
        this.my_rank.height = 160;
        this.my_rank.x = (this.width - this.my_rank.width)/2;
        this.my_rank.y = this.bg_jf.y + this.bg_jf.height - 150;
        bg.height = this.my_rank.height;
        bg.width = this.my_rank.width;
        this.my_rank.addChild(bg);
        this.contentview.addChild(this.my_rank);

        var img_bg = utils.createBitmapByName("level"+data.level_no);
        img_bg.width = 100;
        img_bg.height = 100;
        img_bg.x = 30;
        img_bg.y = 40;
        this.my_rank.addChild(img_bg);

        var img = new eui.Image();
        img.width=75;
        img.height=75;
        img.x = 42;
        img.y = 50;
        var maskShape = new egret.Shape();
        maskShape.graphics.beginFill(0x000000,1);
        maskShape.graphics.drawRoundRect(img.x , img.y ,75,75,40,40);
        maskShape.graphics.endFill();
        this.my_rank.addChild(maskShape);
        img.mask = maskShape;
        img.source = data.head_url;
        this.my_rank.addChild(img);
        

        var level_name = utils.createBitmapByName("levelname"+data.level_no);
        level_name.x = 35;
        level_name.y = 110;
        this.my_rank.addChild(level_name);


        var name_text_str = data.nickname;
        name_text_str = utils.getChar(name_text_str,24);
        var name_text = utils.createTextField();
        name_text.size = 26;
        name_text.textColor = 0xFFFFFF;
        name_text.stroke = 2;
        // name_text.bold = true;
        name_text.strokeColor = 0x6A410D;
        name_text.x = 150;
        name_text.y = 50;
        name_text.width = 270;
        name_text.text = name_text_str;
        name_text.textAlign = "left";
        this.my_rank.addChild(name_text);


        var gr_jifen_time = utils.createTextField();
        gr_jifen_time.text = data.last_add_time.replace(/-/g,'.');
        gr_jifen_time.size = 20;
        gr_jifen_time.textColor = 0x6A410D;
        gr_jifen_time.x = 150;
        gr_jifen_time.y = 100;
        // gr_jifen_title.width = 100;
        // gr_jifen_title.textAlign = "left";
        this.my_rank.addChild(gr_jifen_time);


        var wsb_str = "未上榜";
        for(var i = 0;i<dataSource.length;i++){
           if(data.tvmid == dataSource[i].tvmid){
               wsb_str = "第"+dataSource[i].rank+"名";
           }
        }
        var wsb_text = utils.createTextField();
        wsb_text.size = 35;
        wsb_text.textColor = 0xFFFFFF;
        wsb_text.stroke = 2;
        wsb_text.bold = true;
        wsb_text.strokeColor = 0x6A410D;
        wsb_text.x = 390;
        wsb_text.y = 30;
        wsb_text.width = 200;
        wsb_text.text = wsb_str;
        wsb_text.italic = true;
        wsb_text.textAlign = "right";
        this.my_rank.addChild(wsb_text);


        var jbr_text = utils.createTextField();
        jbr_text.text = "已击败"+data.percent+"%玩家";
        jbr_text.size = 20;
        jbr_text.textColor = 0x6A410D;
        jbr_text.bold = true;
        jbr_text.width = 200;
        jbr_text.y = 80;
        jbr_text.x = 400;
        this.my_rank.addChild(jbr_text);

        var shape = new egret.Shape;
        shape.graphics.beginFill(0x000000,0.2);
        shape.graphics.drawRoundRect(400 , 110 ,200,40,40,40);
        shape.graphics.endFill();
        this.my_rank.addChild(shape);

        var grjf_text = utils.createTextField();
        grjf_text.text = "个人积分";
        grjf_text.size = 22;
        grjf_text.textColor = 0x32616B;
        grjf_text.bold = true;
        // grjf_text.width = 200;
        grjf_text.y = 120;
        grjf_text.x = 410;
        this.my_rank.addChild(grjf_text);

        var jifen_text = utils.createTextField();
        jifen_text.text = data.total_score + "";
        jifen_text.size = 26;
        jifen_text.textColor = 0xF6CD57;
        jifen_text.stroke = 2;
        jifen_text.bold = true;
        jifen_text.strokeColor = 0x6A410D;
        jifen_text.width = 100;
        jifen_text.x = 500;
        jifen_text.y = 117;
        this.my_rank.addChild(jifen_text);

    }


    /**
     * 创建帮会排行榜
     */
    public createBhJiFenView(data:any):void{

        this.emptyLabel_text.visible = false;
        this.emptyLabel_img.visible = false;

        var dataSource = data.list;
        this.tableView.dataSource = dataSource;
        this.tableView.itemRenderer = BhJiFenCell;
        BhJiFenCell.CELLWIDTH = this.tableView.width;
        BhJiFenCell.jfView = this;

        if(dataSource.length <= 0){
           this.emptyLabel_text.visible = true;
            this.emptyLabel_img.visible = true;
        }   

        //帮会排名
        if(this.contentview.contains(this.my_rank)){
            this.contentview.removeChild(this.my_rank);
        }

        if(!data.last_add_time){
           this.tableView.height = this.bg_jf.height - 15;
           return;
        }else{
           this.tableView.height = this.bg_jf.height - 100;
        }

        this.my_rank = new egret.DisplayObjectContainer();

        var bg = utils.createBitmapByName("banghui_mine");
        this.my_rank.width = this.bg_jf.width + 10;
        this.my_rank.height = 160;
        this.my_rank.x = (this.width - this.my_rank.width)/2;
        this.my_rank.y = this.bg_jf.y + this.bg_jf.height - 150;
        bg.height = this.my_rank.height;
        bg.width = this.my_rank.width;
        this.my_rank.addChild(bg);
        this.contentview.addChild(this.my_rank);

        var bh_img = utils.createBitmapByName("bhicon"); 
        // this.bh_img.height = 146;
        // this.bh_img.width = this.width - 30;
        bh_img.y = 45;
        bh_img.x = 40; 
        this.my_rank.addChild(bh_img);
        

        var bh_name_str = data.gang_name;
        bh_name_str = utils.getChar(bh_name_str,24);
        var bh_name = utils.createTextField();
        bh_name.size = 24;
        bh_name.textColor = 0xFFFFFF;
        bh_name.stroke = 2;
        bh_name.bold = true;
        bh_name.strokeColor = 0x6A410D;
        bh_name.x = 120;
        bh_name.y = 50;
        bh_name.width = 220;
        bh_name.text = bh_name_str;
        bh_name.textAlign = "left";
        this.my_rank.addChild(bh_name);

        var img_bg = utils.createBitmapByName("level"+data.level_no);
        img_bg.width = 60;
        img_bg.height = 60;
        img_bg.x = 40;
        img_bg.y = 90;
        this.my_rank.addChild(img_bg);

        var img = new eui.Image();
        img.width=50;
        img.height=50;
        img.x = 45;
        img.y = 95;
        var maskShape = new egret.Shape();
        maskShape.graphics.beginFill(0x000000,1);
        maskShape.graphics.drawRoundRect(img.x , img.y ,50,50,20,20);
        maskShape.graphics.endFill();
        this.my_rank.addChild(maskShape);
        img.mask = maskShape;
        img.source = data.head_url;
        this.my_rank.addChild(img);
        

        var level_name = utils.createBitmapByName("levelname"+data.level_no);
        level_name.x = 40;
        level_name.y = 125;
        level_name.width = 75;
        level_name.height = 22;
        this.my_rank.addChild(level_name);


        var name_text_str = "帮主："+data.nickname;
        name_text_str = utils.getChar(name_text_str,30);
        var name_text = utils.createTextField();
        name_text.size = 24;
        name_text.textColor = 0x6A410D;
        name_text.bold = true;
        name_text.x = 120;
        name_text.y = 115;
        name_text.width = 270;
        name_text.text = name_text_str;
        name_text.textAlign = "left";
        this.my_rank.addChild(name_text);


        var wsb_str = "所在帮会未上榜";
        for(var i = 0;i<dataSource.length;i++){
           if(data.gang_uuid == dataSource[i].gang_uuid){
               wsb_str = "第"+dataSource[i].rank+"名";
           }
        }
        var wsb_text = utils.createTextField();
        wsb_text.size = 35;
        wsb_text.textColor = 0xFFFFFF;
        wsb_text.stroke = 2;
        wsb_text.bold = true;
        wsb_text.strokeColor = 0x6A410D;
        wsb_text.x = 340;
        wsb_text.y = 30;
        wsb_text.width = 250;
        wsb_text.text = wsb_str;
        wsb_text.italic = true;
        wsb_text.textAlign = "right";
        this.my_rank.addChild(wsb_text);


        var shape = new egret.Shape;
        shape.graphics.beginFill(0x000000,0.2);
        shape.graphics.drawRoundRect(400 , 85 ,200,30,40,40);
        shape.graphics.endFill();
        this.my_rank.addChild(shape);

        var grjf_text = utils.createTextField();
        grjf_text.text = "帮会积分";
        grjf_text.size = 20;
        grjf_text.textColor = 0x32616B;
        grjf_text.bold = true;
        // grjf_text.width = 200;
        grjf_text.y = 92;
        grjf_text.x = 410;
        this.my_rank.addChild(grjf_text);

        var jifen_text = utils.createTextField();
        jifen_text.text = data.total_score+"";
        jifen_text.size = 24;
        jifen_text.textColor = 0xF6CD57;
        jifen_text.stroke = 2;
        jifen_text.bold = true;
        jifen_text.strokeColor = 0x6A410D;
        jifen_text.width = 120;
        jifen_text.x = 490;
        jifen_text.y = 90;
        // jifen_text.textAlign = "left";
        this.my_rank.addChild(jifen_text);

        var gr_jifen_time = utils.createTextField();
        gr_jifen_time.text = data.last_add_time.replace(/-/g,'.');
        gr_jifen_time.size = 18;
        gr_jifen_time.textColor = 0x6A410D;
        gr_jifen_time.x = 410;
        gr_jifen_time.y = 130;
        // gr_jifen_title.width = 100;
        // gr_jifen_title.textAlign = "left";
        this.my_rank.addChild(gr_jifen_time);

    }


    public showAwardList(index:number,x:number,evt:egret.TouchEvent,type:string){
        
        if(this.contentview.contains(this.bgMaskAward)){
            this.contentview.removeChild(this.bgMaskAward);
        }

        this.bgMaskAward = new egret.Shape();
        this.bgMaskAward.graphics.beginFill(0x000000, 0);
        this.bgMaskAward.graphics.drawRect(0, 0, this.width, this.height);
        this.bgMaskAward.graphics.endFill();
        this.bgMaskAward.touchEnabled = true;
        this.contentview.addChild(this.bgMaskAward);

        this.bgMaskAward.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
               this.bgMaskAward.visible = false;
               this.award_list_view.visible = false;
        },this);

        if(this.contentview.contains(this.award_list_view)){
            this.contentview.removeChild(this.award_list_view);
        }
        this.award_list_view = new egret.DisplayObjectContainer;
        var bg = utils.createBitmapByName("award_bg");
        bg.width = this.bg_jf.width;
        
        this.award_list_view.addChild(bg);
        this.contentview.addChild(this.award_list_view);

        // this.award_list_view.y = y + this.tableView.y;
        this.award_list_view.y = evt.stageY;
        this.award_list_view.x = x - 440;
        this.award_list_view.height = bg.height;

        let data = [];
        if(type == "gr"){
           data = GameData.personalRank[index-1]['props'];
        }else{
            data = GameData.gangRank[index-1]['props'];
        }
        bg.height = 130 * (Math.floor(data.length/7) + 1) + 20;
        var width = (bg.width)/6;
        var height = 130;
        for(let i=1;i<=data.length;i++){
            var view = new egret.DisplayObjectContainer;
            view.width = width;
            view.height = height;
            view.anchorOffsetX = view.width/2;
            view.anchorOffsetY = view.height/2;
            if(i%6 == 0){
                view.x = width*5 + (width/2);
                view.y = 130 * (Math.floor(i/6)-1) + view.height/2;
            }else{
                view.x = width*(i%6 - 1) + (width/2);
                view.y = 130 * (Math.floor(i/6)) + view.height/2;
            }
            
            
            var  img:eui.Image = new eui.Image();
            let item = data[i-1];
            img.width = width * 0.75;
            img.height = width * 0.75;
            img.anchorOffsetX = img.width/2;
            img.anchorOffsetY = img.height/2;
            img.y = view.height/2;
            img.x = view.width/2;
            img.source = item.prop_img;
            view.addChild(img);

            var text = utils.createTextField();
            text.size = 16;
            text.textColor = 0x6A410D;
            text.bold = true;
            // text.x = (view.width - text.width)/2;
            text.y = img.y + img.height/2 + 5;
            text.width = view.width;
            if(item.count > 1){
              text.text = item.prop_name + " x"+item.count;
            }else{
              text.text = item.prop_name ;
            }
            view.addChild(text);
            this.award_list_view.addChild(view);
            
            view.addEventListener(egret.TouchEvent.TOUCH_TAP,function(){
                var data_tool = {};
                if(item.type == 1){
                    data_tool = {
                        "img":item.prop_img,
                        "name":item.prop_name,
                        "desc":item.prop_desc,
                        "type":item.type
                    }
                }else{
                    data_tool = {
                        "img":item.prop_img,
                        "name":item.prop_name,
                        "desc":item.prop_desc,
                        "type":item.type,
                        "parent_img":item.parent_img,
                        "parent_name":item.parent_name,
                        "parent_desc":item.parent_desc,
                    }
                }
                 Main.showTooInfoView(data_tool);
            },view);
        }
    }
}
